home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 61 / CDRom61.iso / Programas / Express Search / exp_setup.exe / EXWEBDOCS.EXE / Express / Program / webdocs / template / op_sites.js < prev    next >
Encoding:
Text File  |  1999-04-18  |  2.8 KB  |  95 lines

  1.  
  2. $EXP_INCLUDE "form_escape.js"
  3. $EXP_INCLUDE "updown.js"
  4. <SCRIPT LANGUAGE="JavaScript">
  5. <!-- 
  6. var sitenames = new Object();
  7. var urls = new Object();
  8. var descriptions = new Object();
  9.  
  10. $EXP_INIT
  11.  
  12. function selectSource(index) {
  13.     if (sitenames[index] != null)
  14.     {
  15.         document.forms[0].description.value = descriptions[index];
  16.         document.forms[0].url.value = urls[index];
  17.         document.forms[0].sitename.value = sitenames[index];
  18.     }
  19. }
  20.  
  21. function clearMe() {
  22.     document.forms[0].description.value = "";
  23.     document.forms[0].url.value = "";
  24.     document.forms[0].sitename.value = "";
  25.     document.forms[0].sitename.focus();
  26. }
  27.  
  28. function switchPosition(first, second) {
  29.     tmp_value = document.forms[0].sl.options[second].value;
  30.     tmp_text = document.forms[0].sl.options[second].text;
  31.     document.forms[0].sl.options[second].value = document.forms[0].sl.options[first].value;
  32.     document.forms[0].sl.options[second].text = document.forms[0].sl.options[first].text;
  33.     document.forms[0].sl.options[first].value = tmp_value;
  34.     document.forms[0].sl.options[first].text= tmp_text;
  35.     document.forms[0].sl.selectedIndex = first;
  36.  
  37.     // switch the values
  38.     value = descriptions[second];
  39.     descriptions[second] = descriptions[first];
  40.     descriptions[first] = value;
  41.  
  42.     value = urls[second];
  43.     urls[second] = urls[first];
  44.     urls[first] = value;
  45.     
  46.     value = sitenames[second];
  47.     sitenames[second] = sitenames[first];
  48.     sitenames[first] = value;
  49. }
  50.  
  51. var button='apply';
  52. function handleSubmit() {
  53.     if (button == "removeOp") {
  54.         if (document.forms[0].sl.selectedIndex < 0) {
  55.             alert('Please select a web site first.');
  56.             return false;
  57.         }
  58.         if (!window.confirm('Are you sure you want to delete that site?')){     
  59.             return false;
  60.         }
  61.     }
  62.  
  63.     if ((button == "addOp") || (button == "apply") || (button == "ok")) {
  64.         site_name = document.forms[0].sitename.value;
  65.         if ((site_name.length == 0) || (site_name.indexOf(',') != -1)) {
  66.             alert('Name can not be empty or contain commas.');
  67.             return false;
  68.         }
  69.         if (document.forms[0].url.value.length == 0) {
  70.             alert('URL can not be empty.');
  71.             return false;
  72.         }
  73.     }
  74.     param = "";
  75.     for(j=0; j<    document.forms[0].sl.options.length; j++) {
  76.         param = param + "&seq=" + formEscape(document.forms[0].sl.options[j].value);
  77.         if (document.forms[0].sl.options[j].selected) {
  78.             param = param + "&sel=" + formEscape(document.forms[0].sl.options[j].value);
  79.         }
  80.     }
  81.  
  82.     param = param + "&catid=" + formEscape(document.forms[0].catid.options[document.forms[0].catid.selectedIndex].value); 
  83.     param = param + "&sitename=" + formEscape(document.forms[0].sitename.value);
  84.     param = param + "&url=" + formEscape(document.forms[0].url.value);
  85.     param = param + "&description=" + formEscape(document.forms[0].description.value);
  86.  
  87.     self.location = document.forms[0].action+ "?" + button + "=1" + param;
  88.  
  89.     return false;
  90. }
  91. if (isIE3)
  92.     selectSource(0);
  93. //-->
  94. </SCRIPT>
  95.